package service4user

import (
	"Gin-Gorm-boke/boke_common/define"
	models2 "Gin-Gorm-boke/boke_common/models"
	"Gin-Gorm-boke/boke_common/response"
	"github.com/gin-gonic/gin"
	"github.com/jinzhu/copier"
)

type LinkVo struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	Logo        string `json:"logo"`
	Description string `json:"description"`
	Address     string `json:"address"`
}

func GetAllLink(c *gin.Context) {
	var linkList []models2.Link
	models2.Db.Model(new(models2.Link)).
		Where("status = ?", define.LINK_STATUS_NORMAL).Find(&linkList)
	var linkVoList []LinkVo
	copier.Copy(&linkVoList, &linkList)
	response.ResponseOK(c, linkVoList)
	return
}
